package com.jp.knowledge.my.activity;

import android.support.v4.app.Fragment;

import com.jp.knowledge.activity.CompanyBaseAcytivity;
import com.jp.knowledge.my.fragment.AuditListFragment;
import com.jp.knowledge.my.model.ColleagueAuditModel;
import com.jp.knowledge.my.model.OrganizaModel;

import java.util.ArrayList;
import java.util.List;

/**
 * 加入审核
 */
public class AuditJoinActivity extends CompanyBaseAcytivity {


    @Override
    protected String getTitleString() {
        return "加入审核";
    }

    @Override
    protected Fragment getFragment(OrganizaModel company) {
        return new AuditListFragment().newInstance(company);
    }


    @Override
    protected List<OrganizaModel> getCompanys() {

        List<OrganizaModel> list  = userData.getCompanyList();

        List<OrganizaModel> companys = new ArrayList<>();
        for (OrganizaModel company: list) {
            if(company.getCompanyAdmin()==1||company.getCompanyManage()==1){
                companys.add(company);
            }
//            if(company.getIsAudit() == 1)
//                companys.add(company);
        }

        return  companys;

    }

    // 使用观察者模式来通知审核操作
    public interface AuditSubject{
        void addObserver(AuditObserver observer);
    }
    public interface AuditObserver{
        void update(ColleagueAuditModel model);
    }
}
